Skip to content

refactor: rename "bulk" to more accurate "dynamically created" #1538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from

Conversation

metacosm
Copy link
Collaborator

  • refactor: deleteBulkResource -> deleteTargetResource
  • refactor: remove unneeded key parameter
  • refactor: remove unneeded key parameter
  • refactor: rename bulk to dynamically created to be more accurate
  • refactor: remove now unneeded class
  • refactor: more renaming

@metacosm metacosm self-assigned this Oct 12, 2022
@metacosm metacosm requested a review from csviri October 12, 2022 12:00
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 20 Code Smells

22.0% 22.0% Coverage
0.0% 0.0% Duplication

@csviri
Copy link
Collaborator

csviri commented Oct 12, 2022

@metacosm I don't agree that dynamic is more accurate, actually misleading, synce every resource is is dynamically created by an operator nothing is "static". Bulk better describes that we are creating here a set of similar resources.

@csviri
Copy link
Collaborator

csviri commented Oct 12, 2022

Will check the other changes.

* @param context actual context
*/
void deleteBulkResource(P primary, R resource, String key, Context<P> context);
void deleteTargetResource(P primary, R resource, Context<P> context);
Copy link
Collaborator

@csviri csviri Oct 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for rename

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But not sure we want to remove the key. I'm more to more complete APIs, so that is an information that some might miss if providing a custom implementation. So this way it's more future proof, also integral part.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, was debating this last point myself, actually…

implements DependentResourceReconciler<R, P> {

private final BulkDependentResource<R, P> bulkDependentResource;
private final DynamicallyCreatedDependentResource<R, P> delegate;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned don't agree with term 'Dynamic' it's too generic notion. Why Bulk nicely identifies this feature.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bulk doesn't fit either, imo. It kinda worked when the solution was indexed-based but now it's more about dynamically (as opposed to statically known at build time) defined dependents.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the whole feature / funtionality is about to create resources in bulk. That is the only purpose, the only thing that changed is that the key is not an integer but a string.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bulk implies a large number and that's not really what the feature is about. This is about creating some resources that are determined at runtime, as opposed to the other dependents which are known statically at build-time. I agree that "dynamically created" isn't too appropriate but I don't think that "bulk" is, either…

Map<String, R> actualResources, P primary, Context<P> context) {
actualResources.forEach((key, value) -> {
if (!expectedKeys.contains(key)) {
bulkDependentResource.deleteBulkResource(primary, value, key, context);
delegate.deleteTargetResource(primary, value, context);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1


// remove existing resources that are not needed anymore according to the primary state
deleteBulkResourcesIfRequired(desiredResources.keySet(), actualResources, primary, context);
deleteUnexpectedDynamicResources(desiredResources.keySet(), actualResources, primary, context);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not really unexpected. It's natural to have those. Maybe "surplus" ? but not sure if this word used in this context.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about deleteExtraResources?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds great! 👍

@metacosm
Copy link
Collaborator Author

@metacosm I don't agree that dynamic is more accurate, actually misleading, synce every resource is is dynamically created by an operator nothing is "static". Bulk better describes that we are creating here a set of similar resources.

That's not necessarily true anymore, though. It could be anything depending on what the primary spec says. Bulk was only appropriate when things were restricted to index-based similar resources but that's not the case anymore.

@csviri
Copy link
Collaborator

csviri commented Oct 12, 2022

@metacosm I don't agree that dynamic is more accurate, actually misleading, synce every resource is is dynamically created by an operator nothing is "static". Bulk better describes that we are creating here a set of similar resources.

That's not necessarily true anymore, though. It could be anything depending on what the primary spec says. Bulk was only appropriate when things were restricted to index-based similar resources but that's not the case anymore.

Don't understand what do you mean, we still have BulkDependentResource interface, to describe that we are managing those resource is bulk.

@metacosm
Copy link
Collaborator Author

We agreed to keep the bulk name because we couldn't find a better one and "dynamically created" is confusing. Replaced by #1544.

@metacosm metacosm closed this Oct 13, 2022
@metacosm metacosm deleted the further-refine branch December 6, 2022 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants